When choosing names for your identifiers, such as class, package, variable, constant, method, etc., you should adhere to the Java naming standard.
It is not required to do so, though. Convention
rather than rule is how it is known. Several Java communities, such as Sun Microsystems and Netscape, have recommended these norms.
The Java naming convention is used for all of the classes,
interfaces, packages, methods, and fields in the Java programming language. Failure to adhere to these norms might result in muddled or incorrect code.
The common naming conventions applied to the various identifiers are displayed in the table below.
Example
public class Student {
int id;
// your code
}
Example
public class Student {
// your code
}
Example
interface Printable {
// your code
}
Example
class Student {
void shape(){
// your code
}
}
Example
package com.dockertpoint;
class Student {
void shape(){
// your code
}
}
Example
package com.dockertpoint;
class Student {
static final int MAX_FEE = 1800;
// your code
}
Instead than naming Java classes, variables, and methods at random, it is best practise to give them names that reflect what they are intended to achieve. The Java programming language's name standards are listed here. For excellent maintenance and readability of code, they must be complied with when creating Java programme. Java follows the CamelCase convention when naming methods, variables, classes, packages, and constants.
Post your comment